package com.blue.firecat.entity;

import com.blue.firecat.enums.OrderTypeEnum;
import com.blue.firecat.enums.UserStatusEnum;
import com.blue.firecat.enums.UserTypeEnum;
import com.blue.firecat.utils.date.DateUtil;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * @author
 */
public class User implements Serializable {
    /**
     * 主键
     */
    private Long id;

    /**
     * 真实姓名(*)
     */
    private String name;

    /**
     * 账号
     */
    private String userName;

    /**
     * 密码
     */
    private String password;

    /**
     * 邮箱(用于通知打手结算和找回密码)
     */
    private String email;

    private String qq;
    /**
     * 身份证号码(*)
     */
    private String idCard;

    /**
     * 照片路径
     */
    private String photo;

    /**
     * 银行卡号码
     */
    private String bankCard;

    /**
     * 手机号
     */
    private Long phone;

    /**
     * 支付宝账号
     */
    private String aliAccount;

    /**
     * 微信账号
     */
    private String wxAccount;

    /**
     * 创建人id
     */
    private String operate;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 创建时间
     */
    private String createTimeString;

    /**
     * 用户类型,0未知,1管理员,2客服,3打手
     */
    private Integer type;

    /**
     * 用户类型
     */
    private String typeString;

    /**
     * 用户状态,0未知,1已启用,2已停用
     */
    private Integer status;
    /**
     * 用户状态
     */
    private String statusString;



    private static final long serialVersionUID = 1L;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
        if(!StringUtils.isEmpty(email)){
            if(email.contains("qq")){
                String qq = email.substring(0,email.indexOf("@"));
                this.setQq(qq);
            }
        }
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }

    public String getBankCard() {
        return bankCard;
    }

    public void setBankCard(String bankCard) {
        this.bankCard = bankCard;
    }

    public Long getPhone() {
        return phone;
    }

    public void setPhone(Long phone) {
        this.phone = phone;
    }

    public String getAliAccount() {
        return aliAccount;
    }

    public void setAliAccount(String aliAccount) {
        this.aliAccount = aliAccount;
    }

    public String getWxAccount() {
        return wxAccount;
    }

    public void setWxAccount(String wxAccount) {
        this.wxAccount = wxAccount;
    }

    public String getOperate() {
        return operate;
    }

    public void setOperate(String operate) {
        this.operate = operate;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
        this.setCreateTimeString(DateUtil.getInstance().getDateString(createTime));
    }

    public String getCreateTimeString() {
        return createTimeString;
    }

    private void setCreateTimeString(String createTimeString) {
        this.createTimeString = createTimeString;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
        this.setTypeString(UserTypeEnum.getValueByCode(type));
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
        this.setStatusString(UserStatusEnum.getValueByCode(status));
    }

    public String getTypeString() {
        return typeString;
    }

    public void setTypeString(String typeString) {
        this.typeString = typeString;
    }

    public String getStatusString() {
        return statusString;
    }

    public void setStatusString(String statusString) {
        this.statusString = statusString;
    }

    public String getQq() {
        return qq;
    }

    public void setQq(String qq) {
        this.qq = qq;
    }
}